/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.hycreate.platform.modules.crm.workbench;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.hycreate.platform.common.persistence.Page;
import com.hycreate.platform.common.service.CrudService;
import com.hycreate.platform.modules.crm.business.HycrmContact;
import com.hycreate.platform.modules.crm.findcustomer.FindCustomerContact;
import com.hycreate.platform.modules.crm.findcustomer.FindCustomerRecord;
import com.hycreate.platform.modules.crm.mission.WorkLoad;

/**
 * 工作态的主体功能Service
 * @author zzf
 * @version 2016-12-03
 */
@Service
@Transactional(readOnly = true)
public class WorkbenchService extends CrudService<WorkbenchDao, Workbench> {

	public Workbench get(String id) {
		return super.get(id);
	}
	
	public List<Workbench> findList(Workbench workbench) {
		return super.findList(workbench);
	}
	
	public Page<Workbench> findPage(Page<Workbench> page, Workbench workbench) {
		return super.findPage(page, workbench);
	}
	
	
	@Transactional(readOnly = false)
	public void save(Workbench workbench) {
		super.save(workbench);
	}
	
	@Transactional(readOnly = false)
	public void delete(Workbench workbench) {
		super.delete(workbench);
	}
	
	@Transactional(readOnly = false)
	public List<Workbench> getWorkbenchs(String  userid){
		
		
	return 	dao.getWorkbenchs(userid);
	}
	
	@Transactional(readOnly = false)
	public List<FindCustomerContact> getWorkbenchContact(String CustomerId ){
		
		return dao.getWorkbenchContact(CustomerId);
	}
	
	@Transactional(readOnly = false)
	public List<Workbench> getIndustry(String CustomerId){
		
		return dao.getIndustry(CustomerId);
	}
	
	@Transactional(readOnly = false)
	public void workbenchnext(WorkbenchFiledTemp filed){
		
		dao.workbenchnext(filed);
	}
	@Transactional(readOnly = false)
	public void workbenchskip(String customerId){
		
		dao.Workbenchskip(customerId);
	}
	
	@Transactional(readOnly = false)
	public HycrmContact getContactWays(String contactId){
	return	dao.getContactWays(contactId);
	}
	
	
	@Transactional(readOnly = false)
	public void addcollect(WorkbenchNextFiled filed) {
		if (filed.getIsNewRecord()){
			filed.preInsert();
			dao.insert(filed);
		}else{
			filed.preUpdate();
			dao.update(filed);
		}
	}
	@Transactional(readOnly = false)
	public void addCustomerContactRecord(FindCustomerRecord record){
		
		if (record.getIsNewRecord()){
			record.preInsert();
			dao.insertRecord(record);
		}else{
			record.preUpdate();
			dao.updateRecord(record);
		}
		
	}
	@Transactional(readOnly = false)
	public void addUserCustomerCount(CustomerCount count){
		if (count.getIsNewRecord()){
			count.preInsert();
			dao.insertCount(count);
		}else{
			count.preUpdate();
			dao.updateCount(count);
		}
		
		
	}
	
	
	@Transactional(readOnly = false)
	public	int CollectExist(WorkbenchNextFiled filed){
		
		return dao.CollectExist(filed);
	}
	
	@Transactional(readOnly = false)
	public List<Workbench> SelectCustomer(WorkbenchCustomerSelect workselct){
		return dao.SelectCustomer(workselct);
	}
	@Transactional(readOnly = false)
	public void updateuserId(WorkBenchUseridupdate wbud){
		dao.updateuserId(wbud);
	}
	
	@Transactional(readOnly = false)
	public int SelectCount(String userid){
		
		return dao.SelectCount(userid);
	}
	
	@Transactional(readOnly = false)
	public void updateQuantity(String userid){
		
		dao.updateQuantity(userid);
	}
	@Transactional(readOnly = false)
	public int selectnull( String userid){
		
		return dao.selectnull(userid);
	}
	@Transactional(readOnly = false)
	 public void deleteQuantity(String userid){
		dao.deleteQuantity(userid); 
	 }
	
	@Transactional(readOnly = false)
	public String usridIsNull(String CustomerId){
		return dao.usridIsNull(CustomerId);
	}
	
	@Transactional(readOnly = false)
	public void updateCurrntCustomer(String customerId,String userid){
		
		dao.updateCurrntCustomer(customerId,userid);
	}
	
	@Transactional(readOnly = false)
	public void updateCurrentCustomerIsNull(String userid){
		dao.updateCurrentCustomerIsNull(userid);
	}
	
	@Transactional(readOnly = false)
	public void updateAccomplish(String userId){
		
		dao.updateAccomplish(userId);
	}
	
	@Transactional(readOnly = false)
	public WorkLoad timeIsTomorrow(String  dividerId){
		return dao.timeIsTomorrow(dividerId);
	}
	
	
	
	@Transactional(readOnly = false)
	public void  updateWorkLoadTodaydone(){
		dao.updateWorkLoadTodaydone();
	}
	
	@Transactional(readOnly = false)
	public Integer selectquantityIszero(String userId){
		
		return dao.selectquantityIszero(userId);
	}
}